<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="work.atpgroup.entity.User,work.atpgroup.entity.WebPage" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <title>创建我的网页</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
    <link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.7.6/css/layui.css"/>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.min.js" integrity="sha384-IDwe1+LCz02ROU9k972gdyvl+AESN10+x7tBKgc9I5HFtuNz0wWnPclzo6p9vxnk" crossorigin="anonymous"></script>
    <script type="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.0.5/vue.global.js"></script>
    <style>
        body{
            background: azure;
        }
        form{
            display: flex;
            flex-direction: column;
            border: 1px solid black;
        }
        form textarea{
            height: 600px;
        }
        form > div{
            margin: 5px auto;
        }
        .content-label{
            float: left;
        }
        .submit-reset >div{
            float: right;
            margin: 5px 10px;
        }
        .submit-reset input{
            width: 100px;
            height: 40px;
        }

        body{
            background: azure;
        }
        .enroll >div{
            float: right;
            margin: 10px;
            width: 70px;
            height: 30px;
            border: 1px solid cadetblue;
            text-align: center;
        }
        .enroll > div >a{
            line-height: 30px;
            font-size: 16px;
        }
        .enroll{
            display: flex;
            flex-direction: row-reverse;
        }

    </style>
</head>
<body>
<jsp:include page="../share/enroll.jsp"/>
<div class="container">
    <form method="post" action="${pageContext.request.contextPath}/tryCreateWebPage" enctype="multipart/form-data">
        <div class="col-10">
            <label class="col-2" for="uri">访问地址</label>
            <input type="text" id="uri" name="uri" placeholder="例如: love" value="">
        </div>
        <div class="col-10">
            <label class="col-2" for="title">标题</label>
            <input type="text" id="title" name="title" placeholder="请输入网页标题">
        </div>
        <div class="col-10">
            <label class="col-2 content-label" for="content">内容</label>
            <textarea id="content" name="content" class="col-10" placeholder="请在这里输入网页，网页body内部的所有代码"></textarea>
        </div>
        <div class="col-10">
            <label class="col-2" for="css-file">css文件</label>
            <input type="file" id="css-file" name="css-file">
        </div>
        <div class="col-10">
            <label class="col-2" for="js-file">js文件</label>
            <input name="js-file" id="js-file" type="file">
        </div>
        <div class="col-10 submit-reset">
            <div class="col-2">
                <input type="reset" value="重置">
            </div>
            <div class="col-2">
                <input type="submit" value="创建">
            </div>
        </div>
    </form>
</div>
</body>
<script>
    window.onload = cc();
    function cc(){
        var str = <c:choose>
                <c:when test="${cacheWebPage!=null}">
                cacheWebPage.title;
            </c:when>
            <c:otherwise>
                请在这里输入网页的标题
        </c:otherwise>
            </c:choose>
        document.getElementById("title").value = str;
    }
</script>
</html>